<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ajax无刷新分页</title>
	<script type="text/javascript">
		window.onload=function(){
			showpage('./page.php?page=1');
		}
		//这里传递url
		function showpage(url){
		//新建XMLHttpRequest对象
			var xhr=new XMLHttpRequest();
			//onreadystatechange事件
			xhr.onreadystatechange=function(){
			//检测readState属性值
				if (xhr.readyState==4){
					document.getElementById("result").innerHTML=xhr.responseText;
				}
			}
			//open方法开启一个http传输
			xhr.open('get',url);
			//send方法发送数据	
			xhr.send(null);
		}

	</script>
</head>
<body>
	<h2>ajax无刷新分页</h2>
	<div id="result"></div>
</body>
</html>